-
Notifications
You must be signed in to change notification settings - Fork 0
Feature: #9 점령 기간 설정 및 남은 기간 구현 #10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Calendar.date(byAdding:)의 반환값이 옵셔널인 점을 고려하여 guard let으로 바인딩하는 과정에서, 점령 기간(endDate) 계산이 실패할 경우 게임 진행에 심각한 오류가 발생할 수 있어 else 조건에 fatalError()를 사용해 조기 종료 처리했습니다.
복잡한 계산이나 동작이 아닌, 계산된 값을 반환만 하는 간단한 상태 판단이기 때문에 메서드가 아니란 계산 프로퍼티로 구현
- dateComponents()의 첫 번째 파라미터는 Set<Calendar.Component> 타입으로, [.day, .hour, .minute, .second] 등 여러 단위를 한 번에 계산할 수 있는 구조 (작성 시 배열처럼 보이지만 내부적으로는 Set으로 처리됨) - 결과가 nil이거나 종료일 이후로 인해 음수가 발생할 수 있어 '?? 0'과 'max(0, value)'를 사용하여, 항상 0 이상의 값만 반환되도록 보정
- 모델은 데이터 책임만 가지도록 유지 - 기간 판단, 종료 여부, 남은 일수 계산은 별도 extension에서 관리 - 모델과 로직 간 역할 명확화 및 가독성 향상
우선적으로 구현한 로직의 유효성을 빠르게 검증하기 위해 테스트 코드 추가
main/dev 브랜치에 push 또는 PR 시 '유닛 테스트' 코드 자동 실행
This reverts commit 1fab816.
sing-u8
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
수고하셨습니다 ~
근데 커밋에서 마지막에 CI 파이프라인 제거 되어있는데, 잘 안되서 다시 지운 건거야?
x code 버전 문제 때문에 잘 안 되었던 것도 있고 이건 내일 협의 후에 함께 도입 결정 하면 좋을 것 같다는 생각이 들어서 지웠어요-! ㅎㅎ |
01sys10
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
수고하셨습니닷
📌 관련 이슈 (Related Issue)
🧶 주요 변경 내용 (Summary)
📸 스크린샷 (Optional)
🧪 테스트 / 검증 내역
💬 기타 공유 사항
🙇🏻♀️ 리뷰 가이드 (선택)